package com.hzmg.akkacloud.workdemo.service;

import com.hzmg.akkacloud.common.model.WorkerInfo;
import com.hzmg.akkacloud.worker.annotation.RemoteServiceCall;
import com.hzmg.akkacloud.worker.annotation.RemoteServiceClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Map;

@RemoteServiceClass
@Service
public class SimpleService {
    Logger logger = LoggerFactory.getLogger(SimpleService.class);

    @RemoteServiceCall(actorName = "simple")
    public void simple(Map<Integer, String> map) {
        logger.info("simple1 receive");
        logger.info("[simple1]"+map.toString());
    }

    @RemoteServiceCall(actorName = "simple2")
    public Map<Integer, String> simple2(Map<Integer, String> map) {
        logger.info("simple2 receive!!!");
        logger.info("[simple2]"+map.toString());
        map.putIfAbsent(2, "hello");
        return map;
    }
    @RemoteServiceCall(actorName = "simple3")
    public WorkerInfo simple3(WorkerInfo workerInfo) {
        logger.info("simple3 receive!!!");
        logger.info("[simple3]"+workerInfo.toString());
        return workerInfo;
    }
    @RemoteServiceCall(actorName = "simple4")
    public void simple4(WorkerInfo workerInfo) {
        logger.info("simple4 receive!!!");
        logger.info("[simple4]"+workerInfo.toString());
    }
    @RemoteServiceCall(actorName = "simple5")
    public void simple5() {
        logger.info("[simple5]"+"simple5 receive!!!");
    }
    @RemoteServiceCall(actorName = "simple6")
    public WorkerInfo simple6() {
        logger.info("simple6 receive!!!");
        WorkerInfo workerInfo=new WorkerInfo();
        workerInfo.setAkkaAddress("222");
        return workerInfo;
    }
}
